<?php

// ==============================================================================
//
// This file is part of the WelSpeak.
//
// Create by Welfony Support <support@welfony.com>
// Copyright (c) 2012-2014 welfony.com
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
//
// ==============================================================================

$app->get('/', function() use($app) {
    sendResponse(array('message' => sprintf('%s API service', $app->config['app']['name'])));
});

$app->error(function(\Exception $e) use($app) {
    $app->log->getWriter()->write($e, \Slim\Log::ERROR);
    sendResponse(array('message' => 'Internal Server Error'));
});

$app->notFound(function() use($app) {
    sendResponse(array('message' => 'Not Found'));
});

$app->hook('slim.before.router', function() use($app) {
    $app->response()->header('Content-Type', 'application/json');
});